<template>
    <view class="form-box">
        <!--<nui-step :step="2"></nui-step>-->
        <nui-step :step="stepType"></nui-step>
        <u-form :model="form" ref="uForm">
            <!-- <u-form-item label="姓名" label-width="180" prop="name" required
              ><u-input v-model="form.name" placeholder="请输入姓名"
            /></u-form-item> -->
            <!-- <u-form-item label="手机号码" label-width="180" prop="mobile" required
              ><u-input v-model="form.mobile" placeholder="请输入手机号码"
            /></u-form-item> -->
            <u-form-item label="出生日期" label-width="180" prop="identity_date" required
            >
                <u-input
                        type="select"
                        :select-open="idateShow"
                        v-model="form.identity_date"
                        placeholder="请输入出生日期"
                        @click="onBirHandle"
                ></u-input
                >
            </u-form-item>
            <u-form-item label="性别" label-width="180" prop="sex" required
            >
                <u-input
                        type="select"
                        :select-open="actionSexShow"
                        v-model="form.sex"
                        placeholder="请选择性别"
                        @click="onSexHandle"
                ></u-input
                >
            </u-form-item>
            <u-form-item label="民族" label-width="180" prop="nation" required
            >
                <u-input
                        type="select"
                        :select-open="actionNationShow"
                        v-model="form.nation"
                        placeholder="请选择民族"
                        @click="actionNationShow = true"
                ></u-input
                >
            </u-form-item>
            <u-form-item label="籍贯" label-width="180" prop="region" required
            >
                <u-input
                        type="select"
                        :select-open="pickerShow"
                        v-model="form.region"
                        placeholder="请选择籍贯"
                        @click="pickerShow = true"
                ></u-input
                >
            </u-form-item>

            <u-form-item label="家庭地址" label-width="180" prop="homeAddress" :required="reqHomeAddress"
                         v-show="isShowHomeAddress"
            >
                <u-input v-model="form.homeAddress" placeholder="请输入家庭住址"
                />
            </u-form-item>
            <!-- <u-form-item label="入职渠道" label-width="180" prop="channel" required>
              <u-input
                type="select"
                v-model="form.channel"
                placeholder="请选择入职渠道"
                @click="showPickerMax($event)"
              ></u-input
            ></u-form-item>
            <view v-if="checkChannel.id && verifyRecommendChannel(checkChannel.id)">
              <u-form-item label="推荐人" label-width="180" prop="referrer_name"
                ><u-input v-model="form.referrer_name" placeholder="请输入推荐人姓名"
              /></u-form-item>
              <u-form-item label="推荐人ID" label-width="180" prop="referrer_id"
                ><u-input v-model="form.referrer_id" placeholder="请输入推荐人ID"
              /></u-form-item>
              <u-form-item label="推荐人电话" label-width="180" prop="referrer_mobile"
                ><u-input v-model="form.referrer_mobile" placeholder="请输入推荐人手机号码"
              /></u-form-item>
            </view> -->

            <!-- <u-form-item label="是否想晋升为站长" label-width="260" prop="is_siter" required
              ><u-input
                type="select"
                :select-open="actionSiteShow"
                v-model="form.is_siter"
                placeholder="请选择是否想晋升为站长"
                @click="actionSiteShow = true"
              ></u-input
            ></u-form-item> -->

            <u-form-item label="是否住宿" label-width="180" prop="is_hotel" required
            >
                <u-input
                        type="select"
                        :select-open="actionHotelShow"
                        v-model="form.is_hotel"
                        placeholder="请选择是否住宿"
                        @click="actionHotelShow = true"
                ></u-input
                >
            </u-form-item>
            <!-- <view v-if="form.is_hotel == '是'">
              <u-form-item label="住宿开始日期" label-width="180" prop="totel_start_date" required
                ><u-input
                  type="select"
                  :select-open="dateStartShow"
                  v-model="form.totel_start_date"
                  placeholder="请选择住宿开始日期"
                  @click="dateStartShow = true"
                ></u-input
              ></u-form-item>
              <u-form-item label="住宿结束日期" label-width="180" prop="totel_end_date" required
                ><u-input
                  type="select"
                  :select-open="dateEndShow"
                  v-model="form.totel_end_date"
                  placeholder="请选择住宿结束日期"
                  @click="dateEndShow = true"
                ></u-input
              ></u-form-item>
              <u-form-item label="宿舍地址" label-width="180" :prop="actionAdrList.length > 0 ? 'hotel_address' : ''" required
                ><u-input
                  v-model="form.hotel_address"
                  type="select"
                  :select-open="actionAdrShow"
                  @click="actionAdrShow = true"
                  placeholder="请选择宿舍地址"
                  v-if="actionAdrList.length > 0" /><u-input
                  v-model="form.hotel_address"
                  placeholder="该站点暂无宿舍"
                  disabled
                  v-else
              /></u-form-item>
              <u-form-item label="住宿床位号" label-width="180" prop="hotel_number" required>
                <u-input
                  v-model="form.hotel_number"
                  type="select"
                  :select-open="actionSSShow"
                  @click="actionSSShow = true"
                  placeholder="请选择住宿床位号"
              /></u-form-item>
            </view> -->
            <u-form-item label="最高学历" label-width="180" prop="edu_background" required
            >
                <u-input
                        type="select"
                        :select-open="actionEduShow"
                        v-model="form.edu_background"
                        placeholder="请选择最高学历"
                        @click="actionEduShow = true"
                ></u-input
                >
            </u-form-item>
            <u-form-item label="毕业院校" label-width="180" prop="school" required
            >
                <u-input v-model="form.school" placeholder="请输入毕业院校"
                />
            </u-form-item>

            <view v-for="(item, i) in linkmans" :key="i">
                <u-form-item
                        :label="'联系人姓名' + (i + 1)"
                        label-width="180"
                        :prop="i == 0 ? 'contactsName' : ''"
                        :required="i == 0 ? true : false"
                >
                    <u-input v-model="linkmans[i].contactsName" placeholder="请输入紧急联系人姓名" @input="changeName"
                    />
                </u-form-item>
                <u-form-item
                        :label="'联系人关系' + (i + 1)"
                        label-width="180"
                        :prop="i == 0 ? 'contactsRelation' : ''"
                        :required="i == 0 ? true : false"
                >
                    <u-input
                            type="select"
                            :select-open="linkmans[i].actionLinkShow"
                            v-model="linkmans[i].contactsRelationText"
                            placeholder="请选择联系人关系"
                            @click="actionLinkShow(i)"
                            @input="changeRelation"
                    ></u-input
                    >
                </u-form-item>
                <u-form-item
                        :label="'联系人电话' + (i + 1)"
                        label-width="180"
                        :prop="i == 0 ? 'contactsPhonenumber' : ''"
                        :required="i == 0 ? true : false"
                >
                    <u-input
                            type="number"
                            v-model="linkmans[i].contactsPhonenumber"
                            placeholder="请输入联系人电话"
                            maxlength="11"
                            @input="changeMobile"
                    />
                </u-form-item>
            </view>
        </u-form>
        <view>
            <u-button type="success" size="mini" @click="addLinkMan" class="custom-btn1">新增</u-button>
        </view>
        <u-button type="primary" shape="square" :ripple="true" size="medium" @click="submit" class="custom-btn"
        >下一步
        </u-button
        >
        <u-select
                v-model="actionEduShow"
                :list="actionEduList"
                mode="single-column"
                @confirm="actionEduCallback"
        ></u-select>
        <view v-for="(item, i) in linkmans" :key="i">
            <u-select
                    v-model="item.actionLinkShow"
                    :list="actionLinkList"
                    mode="single-column"
                    @confirm="actionLinkCallback"
            ></u-select>
        </view>
        <u-action-sheet :list="actionHotelList" v-model="actionHotelShow" @click="actionHotelCallback"></u-action-sheet>
        <u-action-sheet :list="actionSiteList" v-model="actionSiteShow" @click="actionSiteCallback"></u-action-sheet>
        <u-picker mode="region" v-model="pickerShow" @confirm="regionConfirm"></u-picker>
        <u-calendar
                v-model="dateStartShow"
                @change="changeStartDate"
                :mode="date_mode"
                :max-date="'2030-01-01'"
                safe-area-inset-bottom
        >
        </u-calendar>
        <u-calendar
                v-model="dateEndShow"
                @change="changeEndDate"
                :mode="date_mode"
                :max-date="'2030-01-01'"
                safe-area-inset-bottom
        >
        </u-calendar>
        <u-select
                v-model="actionSheetShow"
                :list="actionSheetList"
                mode="single-column"
                @confirm="actionSheetCallback"
        ></u-select>
        <u-select v-model="actionSSShow" :list="actionSSList" mode="single-column"
                  @confirm="actionSSCallback"></u-select>
        <u-select
                v-model="actionAdrShow"
                :list="actionAdrList"
                mode="single-column"
                @confirm="actionAdrCallback"
        ></u-select>
        <nui-picker
                ref="picker"
                :title="auiPicker.title"
                :layer="auiPicker.layer"
                :data="auiPicker.data"
                @callback="pickerCallback"
        ></nui-picker>
        <u-calendar v-model="idateShow" @change="changeiDate" :mode="idate_mode" safe-area-inset-bottom></u-calendar>
        <u-action-sheet :list="actionSexList" v-model="actionSexShow" @click="actionSexCallback"></u-action-sheet>
        <u-select
                v-model="actionNationShow"
                :list="actionNationList"
                mode="single-column"
                @confirm="actionNationCallback"
        ></u-select>
        <u-modal
                v-model="showModel"
                content="确认提交数据？"
                @confirm="submitData"
                @cancel="cancel"
                show-cancel-button
        ></u-modal>
    </view>
</template>

<script>
    import {mapGetters} from "vuex";
    import AuthInfo from "@/utils/authInfo.js";
    import nuiPicker from "@/components/picker.vue";
    import {GetBirthday, Getsex} from "@/utils/index.js";

    export default {
        components: {
            nuiPicker,
        },
        data() {
            return {
                auiPicker: {
                    title: "选择渠道",
                    layer: null,
                    data: [],
                },
                form: {
                    name: "",
                    mobile: "",
                    region: "", //籍贯
                    channel: "", //渠道
                    referrer_name: "", //推荐人
                    referrer_id: "",
                    referrer_mobile: "",
                    homeAddress: "",
                    is_hotel: "", //是否住宿
                    hotel_address: "", //宿舍地址
                    hotel_number: "", //床位号
                    totel_start_date: "", //住宿日期
                    totel_end_date: "", //住宿日期
                    is_siter: "", //是否想晋升为站长
                    identity_date: "", //出生日期
                    sex: "",
                    nation: "", //民族
                    edu_background: "", //最高学历
                    school: "", //毕业院校
                    contactsName: "",
                    contactsRelation: "",
                    contactsRelationText: "",
                    contactsPhonenumber: "",
                },
                linkmans: [
                    {
                        contactsName: "",
                        contactsRelation: "",
                        contactsRelationText: "",
                        contactsPhonenumber: "",
                        actionLinkShow: false,
                    },
                ], //联系人
                item: {
                    contactsName: "",
                    contactsRelation: "",
                    contactsRelationText: "",
                    contactsPhonenumber: "",
                    actionLinkShow: false,
                },
                curEduValue: "",
                showModel: false,
                idx: 0, //联系人关系索引
                linkLeng: 1, //联系人关系数组长度
                actionEduShow: false,
                actionEduList: [],
                actionLinkList: [],
                idateShow: false,
                idate_mode: "date",
                actionSexShow: false,
                actionNationShow: false,
                sexValue: "",
                nationValue: "",
                checkDept: "",
                // 家庭地址必填
                reqHomeAddress: false,
                //是否显示
                isShowHomeAddress:false,

                actionSexList: [],
                actionNationList: [],
                showModel: false,
                date_mode: "date",
                dateStartShow: false,
                dateEndShow: false,
                pickerShow: false,
                actionSheetShow: false,
                actionSheetList: [],
                actionSSShow: false,
                actionAdrShow: false,
                actionAdrList: [],
                actionSSList: [],
                actionHotelShow: false,
                actionSiteShow: false,
                actionHotelList: [
                    {
                        text: "是",
                    },
                    {
                        text: "否",
                    },
                ],
                actionSiteList: [
                    {
                        text: "是",
                    },
                    {
                        text: "否",
                    },
                ],

                checkChannel: {}, //选中的入职渠道
                checkHotelNum: {}, //选中的床位号
                checkHotelAdr: {}, //选中宿舍地址
                recommendChannel: [],
                rules: {
                    edu_background: [
                        {
                            required: true,
                            message: "请选择最高学历",
                            trigger: "change",
                        },
                    ],
                    school: [
                        {
                            required: true,
                            message: "请输入毕业院校",
                            trigger: ["change", "blur"],
                        },
                    ],
                    contactsName: [
                        {
                            required: true,
                            message: "请输入紧急联系人姓名",
                            trigger: ["change", "blur"],
                        },
                    ],
                    contactsRelation: [
                        {
                            required: true,
                            message: "请选择紧急联系人关系",
                            trigger: ["change", "blur"],
                        },
                    ],
                    contactsPhonenumber: [
                        {
                            required: true,
                            message: "请输入紧急联系人手机号",
                            trigger: ["change", "blur"],
                        },
                        {
                            validator: (rule, value, callback) => {
                                return this.$u.test.mobile(value);
                            },
                            message: "手机号码不正确",
                            trigger: ["change", "blur"],
                        },
                    ],
                    // name: [
                    //   {
                    //     required: true,
                    //     message: "请输入姓名",
                    //     trigger: ["change", "blur"],
                    //   },
                    // ],
                    identity_date: [
                        {
                            required: true,
                            message: "请输入出生日期",
                            trigger: "change",
                        },
                    ],
                    sex: [
                        {
                            required: true,
                            message: "请选择性别",
                            trigger: "change",
                        },
                    ],
                    nation: [
                        {
                            required: true,
                            message: "请选择民族",
                            trigger: "change",
                        },
                    ],
                    mobile: [
                        {
                            required: true,
                            message: "请输入手机号",
                            trigger: ["change", "blur"],
                        },
                        {
                            validator: (rule, value, callback) => {
                                return this.$u.test.mobile(value);
                            },
                            message: "手机号码不正确",
                            trigger: ["change", "blur"],
                        },
                    ],
                    region: [
                        {
                            required: true,
                            message: "请选择籍贯",
                            trigger: "change",
                        },
                    ],
                    // channel: [
                    //   {
                    //     required: true,
                    //     message: "请选择入职渠道",
                    //     trigger: "change",
                    //   },
                    // ],
                    // totel_start_date: [
                    //   {
                    //     required: true,
                    //     message: "请选择住宿开始日期",
                    //     trigger: "change",
                    //   },
                    // ],
                    // totel_end_date: [
                    //   {
                    //     required: true,
                    //     message: "请选择住宿结束日期",
                    //     trigger: "change",
                    //   },
                    // ],
                    // is_siter: [
                    //   {
                    //     required: true,
                    //     message: "请选择是否想晋升为站长",
                    //     trigger: "change",
                    //   },
                    // ],
                    is_hotel: [
                        {
                            required: true,
                            message: "请选择是否住宿",
                            trigger: "change",
                        },
                    ],
                    // hotel_address: [
                    //   {
                    //     required: true,
                    //     message: "请输入宿舍地址",
                    //     trigger: ["change", "blur"],
                    //   },
                    // ],
                    // hotel_number: [
                    //   {
                    //     required: true,
                    //     message: "请输入床位号",
                    //     trigger: ["change", "blur"],
                    //   },
                    // ],
                },
            };
        },
        computed: {
            ...mapGetters([
                "nations",
                "sexs",
                "idCardNo",
                "phonenumber",
                "userInfo",
                "stepType",
                "highestEducations",
                "emergencyContacts",
                'qrCodeId'
            ]),
        },
        mounted() {
            this.highestEducations.forEach((item) => {
                this.actionEduList.push({
                    value: item.dictValue,
                    label: item.dictLabel,
                });
            });
            this.emergencyContacts.forEach((item) => {
                this.actionLinkList.push({
                    value: item.dictValue,
                    label: item.dictLabel,
                });
            });

            if (this.userInfo.highestEducation != "") {
                this.actionEduList.forEach((item) => {
                    if (item.value == this.userInfo.highestEducation) {
                        this.form.edu_background = item.label;
                        this.curEduValue = item.value;
                    }
                });
            }

            this.userInfo.graduatedFrom != "" && (this.form.school = this.userInfo.graduatedFrom);
            let contacts = this.userInfo.ridInductionContactVoList;
            if (contacts.length > 0) {
                this.form.contactsName = contacts[0]["contactsName"];
                this.form.contactsRelation = contacts[0]["contactsRelation"];
                this.form.contactsRelationText = contacts[0]["contactsRelationText"];
                this.form.contactsPhonenumber = contacts[0]["contactsPhonenumber"];

                this.linkmans = [];
                contacts.forEach((item) => {
                    this.linkmans.push({
                        contactsName: item.contactsName,
                        contactsRelation: item.contactsRelation,
                        contactsRelationText: item.contactsRelationText,
                        contactsPhonenumber: item.contactsPhonenumber,
                        actionLinkShow: false,
                    });
                });
            }
            this.nations.forEach((item) => {
                this.actionNationList.push({
                    value: item.dictValue,
                    label: item.dictLabel,
                });
            });
            this.sexs.forEach((item) => {
                this.actionSexList.push({
                    value: item.dictValue,
                    text: item.dictLabel,
                });
            });
            this.changeSexStatus(this.idCardNo);
            if (this.userInfo.nation != "") {
                this.actionNationList.forEach((item) => {
                    if (item.value == this.userInfo.nation) {
                        this.form.nation = item.label;
                        this.nationValue = item.value;
                    }
                });
            }
            this.form.mobile = this.phonenumber;
            this.auiPicker.data = this.userInfo.inductionChannels;
            this.actionSSList = Array.from({length: 20}).map((item, index) => {
                let label = (index + 1).toString();
                return {
                    label,
                };
            });
            this.userInfo.dormitories &&
            this.userInfo.dormitories.length > 0 &&
            this.userInfo.dormitories.forEach((item) => {
                this.actionAdrList.push({
                    value: item.dormitoryId,
                    label: item.address,
                });
            });

            // this.userInfo.name != "" && (this.form.name = this.userInfo.name);
            this.userInfo.phonenumber != "" && (this.form.mobile = this.userInfo.phonenumber);
            this.userInfo.place != "" && (this.form.region = this.userInfo.place);

            // if (this.userInfo.inductionChannelItem != null) {
            //   this.checkChannel = this.userInfo.inductionChannelItem;
            //   this.form.channel = this.userInfo.inductionChannelItem.label;
            // }

            this.userInfo.recommender != "" && (this.form.referrer_name = this.userInfo.recommender);
            this.userInfo.recommenderId != "" && (this.form.referrer_id = this.userInfo.recommenderId);
            this.userInfo.recommenderPhonenumber != "" && (this.form.referrer_mobile = this.userInfo.recommenderPhonenumber);

            if (this.userInfo.isDormitory != "") {
                this.userInfo.isDormitory == "10001" ? (this.form.is_hotel = "是") : (this.form.is_hotel = "否");
            }

            if (this.userInfo.dormitoryAddress != "") {
                this.userInfo.dormitories &&
                this.userInfo.dormitories.length > 0 &&
                this.userInfo.dormitories.forEach((item) => {
                    if (item.dormitoryId == this.userInfo.dormitoryAddress) {
                        this.form.hotel_address = item.address;
                        this.checkHotelAdr = {
                            value: item.dormitoryId,
                            label: item.address,
                        };
                    }
                });
            }

            // this.userInfo.dormitoryAddress != "" && (this.form.hotel_address = this.userInfo.dormitoryAddress);
            this.userInfo.dormitoryNo != "" && (this.form.hotel_number = this.userInfo.dormitoryNo);
            this.userInfo.dormitoryBeginDate != "" && (this.form.totel_start_date = this.userInfo.dormitoryBeginDate);
            this.userInfo.dormitoryEndDate != "" && (this.form.totel_end_date = this.userInfo.dormitoryEndDate);

            // if (this.userInfo.isPromotion != "") {
            //   this.userInfo.isPromotion == "10001" ? (this.form.is_siter = "是") : (this.form.is_siter = "否");
            // }

            this.recommendChannels = this.userInfo.recommendChannels;
            this.userInfo.homeAddress != "" && (this.form.homeAddress = this.userInfo.homeAddress);
            let that =this;
            this.$api.dept.getDept().then(function (res) {
                // TODO 宿迁麦田临时配置
                if(res.code==200 && res.data===5357){
                    that.isShowHomeAddress=true;
                    that.reqHomeAddress=true;
                    that.rules.homeAddress = [
                        {
                            required: true,
                            message: "请填写家庭住址",
                            trigger: ["change", "blur"],
                        },
                    ]
                }
            });
        },
        methods: {
            changeName(e) {
                this.form.contactsName = e;
            },
            changeMobile(e) {
                this.form.contactsPhonenumber = e;
            },
            changeRelation(e) {
                this.form.contactsRelation = e;
            },
            onBirHandle() {
                this.idateShow = true;
            },
            onSexHandle() {
                this.actionSexShow = true;
            },
            changeSexStatus(idCardNo) {
                if (idCardNo != "") {
                    this.form.identity_date = GetBirthday(idCardNo);
                    this.form.sex = Getsex(idCardNo);
                    this.sexValue = this.form.sex == "男" ? "0" : "1";
                } else {
                    this.form.identity_date = "";
                    this.form.sex = "";
                    this.sexValue = "";
                }
            },
            changeiDate(e) {
                this.form.identity_date = e.result;
            },
            actionSexCallback(index) {
                uni.hideKeyboard();
                this.form.sex = this.actionSexList[index].text;
                this.sexValue = this.actionSexList[index].value;
            },
            actionNationCallback(e) {
                this.form.nation = e[0].label;
                this.nationValue = e[0].value;
            },
            //显示picker多级联动弹窗
            showPickerMax(e) {
                const _this = this;
                _this.auiPicker.layer = null;
                _this.$refs.picker.open();
            },
            //picker多级联动回调
            pickerCallback(e) {
                let data = e.data;
                this.checkChannel = data[data.length - 1];
                this.form.channel = this.checkChannel.label;
            },



            submit() {
                this.$refs.uForm.validate((valid) => {
                    if (valid) {
                        this.showModel = true;
                    } else {
                        ui.showModal({
                            title: "提示",
                            content: "验证失败",
                        });
                    }
                });
            },
            submitData() {
                this.submitInfo();

                // this.$u.route("pages/step_two/index");
            },
            cancel() {
                this.showModel = false;
            },
            async submitInfo() {
                let {
                    // name,
                    mobile,
                    region,
                    referrer_name,
                    referrer_id,
                    referrer_mobile,
                    is_hotel,
                    // hotel_number,
                    // totel_start_date,
                    // totel_end_date,
                    identity_date,
                    school
                    // is_siter,
                } = this.form;
                let params = {
                    step: "1",
                    // name,
                    phonenumber: mobile,
                    place: region,
                    // inductionChannel: this.checkChannel.id,
                    recommender: referrer_name == "" ? "无" : referrer_name,
                    recommenderId: referrer_id == "" ? "无" : referrer_id,
                    recommenderPhonenumber: referrer_mobile == "" ? "无" : referrer_mobile,
                    isDormitory: is_hotel != "" ? (is_hotel == "是" ? "10001" : "10002") : "",
                    // dormitoryAddress: this.checkHotelAdr.value,
                    // dormitoryNo: hotel_number,
                    // dormitoryBeginDate: totel_start_date,
                    // dormitoryEndDate: totel_end_date,
                    birthDate: identity_date,
                    sex: this.sexValue,
                    nation: this.nationValue,
                    highestEducation: this.curEduValue,
                    homeAddress: this.form.homeAddress,
                    graduatedFrom: school,
                    ridInductionContactVoList: this.linkmans,
                    qrcodeId: this.qrCodeId
                    // isPromotion: is_siter != "" ? (is_siter == "是" ? "10001" : "10002") : "",
                };
                let res = await this.$api.riders.inductionRecord(params);
                if (res.code != 200) {
                    uni.showToast({
                        title: res.msg,
                        icon: "error",
                    });
                    return;
                }
                uni.showToast({
                    title: "数据已提交",
                    icon: "success",
                });
                AuthInfo.checkUserStatus();
            },
            actionEduCallback(e) {
                this.form.edu_background = e[0].label;
                this.curEduValue = e[0].value;
            },
            actionLinkCallback(e) {
                this.form.contactsRelation = e[0].label;
                this.linkmans[this.idx]["contactsRelationText"] = e[0].label;
                this.linkmans[this.idx]["contactsRelation"] = e[0].value;
            },
            actionLinkShow(i) {
                this.idx = i;
                this.linkmans[i]["actionLinkShow"] = true;
            },
            addLinkMan() {
                this.$set(this.linkmans, this.linkmans.length, {
                    contactsName: "",
                    contactsRelation: "",
                    contactsRelationText: "",
                    contactsPhonenumber: "",
                    actionLinkShow: false,
                });
            },
            // 点击actionSheet回调，入职渠道回调
            // actionSheetCallback(e) {
            //   this.form.channel = e[0].label;
            //   this.checkChannel = e[0];
            // },
            actionSSCallback(e) {
                this.form.hotel_number = e[0].label;
            },
            actionAdrCallback(e) {
                this.form.hotel_address = e[0].label;
                this.checkHotelAdr = e[0];
            },
            // 选择籍贯回调
            regionConfirm(e) {
                this.form.region = e.province.label + "-" + e.city.label + "-" + e.area.label;
            },
            // 点击actionHotel回调，是否住宿回调
            actionHotelCallback(index) {
                uni.hideKeyboard();
                this.form.is_hotel = this.actionHotelList[index].text;
            },
            actionSiteCallback(index) {
                uni.hideKeyboard();
                this.form.is_siter = this.actionSiteList[index].text;
            },
            changeStartDate(e) {
                this.form.totel_start_date = e.result;
            },
            changeEndDate(e) {
                this.form.totel_end_date = e.result;
            },
            verifyRecommendChannel(id) {
                return this.userInfo.recommendChannel.indexOf("" + id) != -1;
            },
        },
        // 必须要在onReady生命周期，因为onLoad生命周期组件可能尚未创建完毕
        onReady() {
            this.$refs.uForm.setRules(this.rules);
        },
    };
</script>

<style lang="scss" scoped>
    .form-box {
        padding: 20px;
    }

    .custom-btn {
        margin: 15px auto;
        left: 50%;
        transform: translateX(-50%);
    }

    .custom-btn1 {
        margin: 15px auto;
        left: 50%;
        transform: translateX(-50%);
    }
</style>
